<template>
	<NavBar v-if="showNavbar" ref="navBarRef" />
	<!-- 动态绑定 height 样式 -->
	<div v-if="showNavbar" :style="{ height: navBarRef?.navHeight || '0px' }"></div>
	<RouterView />
</template>

<script setup lang="ts">
import { useRoute } from 'vue-router';
import NavBar from './views/NavBar.vue';
import { computed, ref } from 'vue';

const route = useRoute();
const navBarRef = ref(null);

// 判断是否显示导航栏，默认值为 true
const showNavbar = computed(() => {
	return route.meta.showNavbar !== false; // 如果未定义或为 true，则显示导航栏
});
</script>